/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jxsm.cz.controller;



import com.jxsm.cz.biz.BizDemoInfo;
import com.jxsm.cz.model.DemoInfo;
import com.jxsm.config.Message;
import com.jxsm.jxbrms.query.QueryController;


/**
 *
 * @author lenovo
 */
public class DemoInfoController extends QueryController {

    public void added() {
        BizDemoInfo bizDemoInfo = new BizDemoInfo();
        DemoInfo di = this.getModel(DemoInfo.class);
        bizDemoInfo.addTx(di);
        if (bizDemoInfo.isSuccess()) {
            this.renderAddSuccess(di.getStr("name"));
        } else {
            this.renderAddFail(bizDemoInfo.getErrorInfo(), di.getStr("name"));
        }
    }

    public void edited() {
        BizDemoInfo bizDemoInfo = new BizDemoInfo();
        DemoInfo di = this.getModel(DemoInfo.class);
        bizDemoInfo.editTx(di);
        if (bizDemoInfo.isSuccess()) {
            this.setMessage(new Message(0, "0", "信息更新成功"));
            this.renderMessage();
        } else {
            this.setMessage(new Message(2, "0", "信息更新失败!"));
            this.renderMessage();
        }
    }

}
